export default function computDetailRight(
  callback: (arg0: number) => void,
  element: HTMLDivElement
) {
  const computed = () => {
    const detailDom = element || document.querySelector('#detail')
    if(detailDom===null) return;
    const documentWidth = (document.querySelector(
      'body'
    ) as HTMLElement).getBoundingClientRect().right
    const detailRight = (detailDom as HTMLDivElement).getBoundingClientRect()
      .right
    callback(documentWidth - detailRight + 40)
  }
  window.addEventListener('resize', computed)
  computed()
}
